package cn.jihhhh.chatglm.session;

import cn.jihhhh.chatglm.model.ChatCompletionRequest;
import cn.jihhhh.chatglm.model.ChatCompletionSyncResponse;
import cn.jihhhh.chatglm.model.ImageCompletionRequest;
import cn.jihhhh.chatglm.model.ImageCompletionResponse;
import okhttp3.sse.EventSource;
import okhttp3.sse.EventSourceListener;

import java.util.concurrent.CompletableFuture;

/**
 * 会话服务接口
 *
 * @author JIHHHH
 * @date 2025-01-12
 */
public interface OpenAiSession {
    EventSource completions(ChatCompletionRequest chatCompletionRequest, EventSourceListener eventSourceListener) throws Exception;

    CompletableFuture<String> completions(ChatCompletionRequest chatCompletionRequest) throws Exception;

    ChatCompletionSyncResponse completionsSync(ChatCompletionRequest chatCompletionRequest) throws Exception;

    ImageCompletionResponse genImages(ImageCompletionRequest imageCompletionRequest) throws Exception;

    Configuration configuration();
}
